-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: nicer tracebacks in run mode on scripts #1191
Conversation
c8bb144
to
6aec4e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks lovely! I think there could be some slight deduplication, otherwise wonderful!
My motivation for this is that people can now use this pipx functionality in scripts instead of directly, in which case this PR’s changes will come in handy for debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I think we should really enable merge queues, this constant branch updating is annoying. |
a1fd530
to
19d9e62
Compare
Happy for this patch! Running script instead of string solve another problem: run the script via shebang |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test please
What should this do if a URI is passed, by the way? Currently that still says |
19d9e62
to
72388ea
Compare
Perhaps we can have an additional check here? Line 57 in 5563ae6
|
A check wouldn't help, we are already doing the "right" think (since when getting a URI it needs to be downloaded, possibly from a remote source), it's just then a question of if there's a way to get it to show something nicer than IMO the big one to fix though is the one in this PR, with URI's being a second, smaller improvement later. I'd expect running on a local file to give the right traceback, not sure I'd expect it from an arbitrary URI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's rebase and add changelog.
Signed-off-by: Henry Schreiner <[email protected]>
Co-authored-by: Philipp A. <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
for more information, see https://pre-commit.ci
cefcd77
to
6106cd5
Compare
This is one way to improve the tracebacks as reported in #1187 and mentioned in #1180.
docs/changelog.md
Summary of changes
This is the simplest way I initially see to get filenames. Instead of passing around the contents of the script as a string, scripts are passed around as Paths, which allows the run command to run the path rather than passing the string on the command line.
Test plan
If you start with this script:
You get this:
After this PR, you get this: